﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AddEditQuizQuestions.aspx.vb" Inherits="Training.AddEditQuizQuestions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Training - Training:: Add/Edit Quiz Questions</title>
<link rel="Stylesheet" type="text/css" media="screen" href="../css/adminStyle.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="ctr">
        <h2>Add or Edit Quiz Questions for :: 
            <asp:Label ID="lblQuiz" runat="server" Text=""></asp:Label></h2>
            
        <p>(Image Placement: 0 = right, 1 = top)</p>
            
        <asp:GridView ID="gvQuestions" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" DataKeyNames="QuestionID" 
            DataSourceID="dsQuestions" 
            EmptyDataText="No questions loaded for this quiz yet" Width="100%">
            <RowStyle CssClass="row1" />
            <EmptyDataRowStyle CssClass="row1" />
            <Columns>
                <asp:BoundField DataField="QuestionID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="QuestionID">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="Question" HeaderText="Question" 
                    SortExpression="Question">
                <HeaderStyle HorizontalAlign="Left" />
                <ItemStyle HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Image" SortExpression="QuestionImage">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("QuestionImage") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#ViewImage(Eval("QuestionImage"))%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:BoundField DataField="ImagePlacement" HeaderText="Placement" 
                    SortExpression="ImagePlacement">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="QuestionOrder" HeaderText="Order" 
                    SortExpression="QuestionOrder">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Edit Answers">
                    <ItemTemplate>
                        <%#AnswersLink(Eval("QuestionID"), Eval("Question"), Eval("QuestionOrder"))%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete Question">
                    <ItemTemplate>
                        <%#DeleteLink(Eval("QuestionID"))%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
            </Columns>
            <PagerStyle CssClass="row1" />
            <HeaderStyle CssClass="rowHead" ForeColor="White" />
            <EditRowStyle CssClass="row1" />
            <AlternatingRowStyle CssClass="row2" />
        </asp:GridView>
        
        <p><asp:HyperLink ID="hypAddQuizQuestion" Text="Add New Question for this Quiz" 
            runat="server"></asp:HyperLink></p>
    
        <p><b><a href="QuizControl.aspx">Quiz Control</a></b></p>
        <br />
        <p><a href="Default.aspx">Admin Main</a></p>
    </div>
    
    <asp:SqlDataSource ID="dsQuestions" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Conn %>" 
        SelectCommand="proc_GetQuizQuestionsByQuizID" 
        SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:QueryStringParameter Name="QuizID" QueryStringField="qid" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
